<template>
	<div class="Word">
	  <div style="height: 800px; width: auto" v-html="poHtmlCode" />
	</div>
</template>

<script>
	import axios from 'axios';
	  export default{
	    name: 'Word',
	    data(){
	      return {
	        poHtmlCode: '',
	
	      }
	    },
	    created: function(){
	      //由于vue中的axios拦截器给请求加token都得是ajax请求，所以这里必须是axios方式去请求后台打开文件的controller
	      axios.post("/api/DataRegionEdit/Word").then((response) => {
	        this.poHtmlCode = response.data;
	
	      }).catch(function (err) {
	        console.log(err)
	      })
	    },
	    methods:{
	      //控件中的一些常用方法都在这里调用，比如保存，打印等等
			Save() {
				pageofficectrl.WebSave();
			},

			ShowDefineDataRegions() {
				var drDefinedJson = pageofficectrl.word.DataRegionsDefinedAsJson;
				// alert(drDefinedJson);
				pageofficectrl.ShowHtmlModelessDialog("dataRegionDlg", drDefinedJson, "left=300px;top=390px;width=700px;height=410px;frame:no;");
			},

			OnPageOfficeCtrlInit() {
				pageofficectrl.AddCustomToolButton("保存", "Save", 1);
				pageofficectrl.AddCustomToolButton("定义数据区域", "ShowDefineDataRegions", 10);
			}
	    },
		
	    mounted: function(){
	      // 将vue中的方法赋值给window
	      window.Save = this.Save;
		  window.ShowDefineDataRegions = this.ShowDefineDataRegions;		  
		  window.OnPageOfficeCtrlInit = this.OnPageOfficeCtrlInit;		  
	    }
	}
</script>

